package com.huan.dao.mapper;

import com.huan.pojo.Teach;
import org.apache.ibatis.annotations.*;
import java.util.List;

public interface TeachMapper {
    /**
     * 查询总记录数
     * @return
     */
    @Select("select count(*) from 讲授")
    int selectTotalCount();


    /**
     * 分页条件查询
     * @param begin
     * @param size
     * @return
     */
    List<Teach> selectByPageAndCondition(@Param("begin") int begin, @Param("size") int size, @Param("teach") Teach teach);

    /**
     * 根据条件查询总记录数
     * @return
     */
    int selectTotalCountByCondition(Teach teach);

    /**
     * 增加
     * @param teach
     */
    @Insert("insert into 讲授 values(#{teacherID},#{courseID},#{time})")
    boolean add(Teach teach);

    /**
     * 编辑
     * @param teach
     */
    @Update("update 讲授 set teacherID = #{teacherID},courseID = #{courseID},time = #{time} where teacherID = #{teacherID} and courseID = #{courseID}")
    int update(Teach teach);

    /**
     * 删除
     * @param teacherID
     * @param courseID
     */
    @Delete("delete from 讲授 where teacherID = #{teacherID} and courseID = #{courseID}")
    void delete(@Param("teacherID") String teacherID, @Param("courseID") String courseID);


}
